%%%WTI
load wti_daily;
x=data(:,1:30);
d=size(x,1);
x1=ones(d);
x1=x1(:,1);
x=[x1,x];
y=data(:,31);
b=inv(x'*x)*x'*y;

resid=y-x*b;
sigmahat=std(resid);
%first restriction sum of real activity
R1=[0 1 1 1 -1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1];
%R1=[0 1 1 1 -1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0];
tstat1=(R1*b)/(sigmahat*(R1*inv(x'*x)*R1')^(1/2))
%second restriction sum of real activity
R2=[0 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 -1];
tstat2=(R2*b)/(sigmahat*(R2*inv(x'*x)*R2')^(1/2))
%third restriction sum of real activity
R3=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0];
tstat3=(R3*b)/(sigmahat*(R3*inv(x'*x)*R3')^(1/2))
%fourth restriction sum of real activity
R4=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0];
tstat4=(R4*b)/(sigmahat*(R4*inv(x'*x)*R4')^(1/2))

load wti_monthly;
x=data(:,1:30);
d=size(x,1);
x1=ones(d);
x1=x1(:,1);
x=[x1,x];
y=data(:,31);
b=inv(x'*x)*x'*y;

resid=y-x*b;
sigmahat=std(resid);
%first restriction sum of real activity
R1=[0 1 1 1 -1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1];
%R1=[0 1 1 1 -1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0];
tstat1=(R1*b)/(sigmahat*(R1*inv(x'*x)*R1')^(1/2))
%second restriction sum of real activity
R2=[0 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 -1];
tstat2=(R2*b)/(sigmahat*(R2*inv(x'*x)*R2')^(1/2))
%third restriction sum of real activity
R3=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0];
tstat3=(R3*b)/(sigmahat*(R3*inv(x'*x)*R3')^(1/2))
%fourth restriction sum of real activity
R4=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0];
tstat4=(R4*b)/(sigmahat*(R4*inv(x'*x)*R4')^(1/2))

%%%Gasoline Prices
load gas_daily;
x=data(:,1:30);
d=size(x,1);
x1=ones(d);
x1=x1(:,1);
x=[x1,x];
y=data(:,31);
b=inv(x'*x)*x'*y;

resid=y-x*b;
sigmahat=std(resid);
%first restriction sum of real activity
R1=[0 1 1 1 -1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1];
%R1=[0 1 1 1 -1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0];
tstat1=(R1*b)/(sigmahat*(R1*inv(x'*x)*R1')^(1/2))
%second restriction sum of real activity
R2=[0 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 -1];
tstat2=(R2*b)/(sigmahat*(R2*inv(x'*x)*R2')^(1/2))
%third restriction sum of real activity
R3=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0];
tstat3=(R3*b)/(sigmahat*(R3*inv(x'*x)*R3')^(1/2))
%fourth restriction sum of real activity
R4=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0];
tstat4=(R4*b)/(sigmahat*(R4*inv(x'*x)*R4')^(1/2))

load gas_monthly;
x=data(:,1:30);
d=size(x,1);
x1=ones(d);
x1=x1(:,1);
x=[x1,x];
y=data(:,31);
b=inv(x'*x)*x'*y;

resid=y-x*b;
sigmahat=std(resid);
%first restriction sum of real activity
R1=[0 1 1 1 -1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1];
%R1=[0 1 1 1 -1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0];
tstat1=(R1*b)/(sigmahat*(R1*inv(x'*x)*R1')^(1/2))
%second restriction sum of real activity
R2=[0 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 -1];
tstat2=(R2*b)/(sigmahat*(R2*inv(x'*x)*R2')^(1/2))
%third restriction sum of real activity
R3=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0];
tstat3=(R3*b)/(sigmahat*(R3*inv(x'*x)*R3')^(1/2))
%fourth restriction sum of real activity
R4=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0];
tstat4=(R4*b)/(sigmahat*(R4*inv(x'*x)*R4')^(1/2))
tstat4=(R4*b)/(sigmahat*(R4*inv(x'*x)*R4')^(1/2))